﻿using DropBoxClient.Entities;
using DropBoxClient.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.Serialization.Json;
using System.Text;

namespace DropBoxClient.Operations
{
    internal class GetCopyRefOperation
    {
        private static readonly string Url = "https://api.dropbox.com/1/copy_ref/{0}/{1}";
        private static readonly string MethodType = StringConstants.GetMethodType;

        private WebOperation<CopyReference> _operation;
        private string _accessToken;

        internal string Root { get; set; }
        internal string Path { get; set; }

        internal GetCopyRefOperation(string accessToken)
        {
            _accessToken = accessToken;
        }

        internal CopyReference Execute()
        {
            string url = string.Format(Url, Root, Path);
            _operation = new WebOperation<CopyReference>(url, _accessToken, MethodType);
            return _operation.Execute();
        }
    }
}
